
"use strict";

const _global = typeof window !== 'undefined' ? window : typeof globalThis !== 'undefined' ? globalThis : typeof GameGlobal !== 'undefined' ? GameGlobal : {};
var pfEnv = typeof _global.ks !== 'undefined' ? _global.ks : typeof _global.tt !== 'undefined' ? _global.tt : typeof _global.wx !== 'undefined' ? _global.wx : null;

function iapJudge(t, e) {
    return t.orderId && "string" == typeof t.orderId ? "number" != typeof t.amount || t.amount !== t.amount ? (console.warn("请填写正确的订单金额"), !1) : "string" != typeof t.currencyType || 3 !== t.currencyType.length ? (console.warn("请填写正确的货币类型"), !1) : !e || "string" == typeof t.paymentType || void 0 === t.paymentType || (console.warn("请填写正确的支付方式"), !1) : (console.warn("请填写正确的订单ID"), !1)
}

var _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ?
    function (t) {
        return typeof t
    } : function (t) {
        return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t
    },
    _requestUrl = "https://h5.udrig.com/app/wx/v1",
    _uidKey = "openId",
    _openId = null,
    _openIdCallback = [],
    _version = ["1", "0", "10"],
    waitFlag = {
        device: !0,
        network: !0,
        uid: !0
    },
    appInfo = {
        sdk: {
            version: _version[0],
            minorVersion: _version[1],
            build: _version[2],
            platform: "Weapp",
            partner: ""
        },
        app: {
            versionCode: "1",
            versionName: "1.0.0",
            installTime: 0,
            displayName: '',
            appKey: '',
            uniqueId: 'wxAppId',
            channel: ''
        },
        device: {
            type: "mobile",
            softwareConfig: {},
            hardwareConfig: {},
            deviceId: {}
        },
        networks: [{
            type: "wifi",
            available: !1,
            connected: !1
        },
        {
            type: "cellular",
            available: !1,
            connected: !1,
            current: []
        },
        {
            type: "unknown",
            available: !1,
            connected: !1
        }],
        locations: [{}],
        appContext: {}
    },
    regeneratorRuntime = function (t) {
        function e(t, e, n, i) {
            var o = e && e.prototype instanceof r ? e : r,
                a = Object.create(o.prototype),
                c = new d(i || []);
            return a._invoke = u(t, n, c),
                a
        }
        function n(t, e, n) {
            try {
                return {
                    type: "normal",
                    arg: t.call(e, n)
                }
            } catch (t) {
                return {
                    type: "throw",
                    arg: t
                }
            }
        }
        function r() { }
        function i() { }
        function o() { }
        function a(t) {
            ["next", "throw", "return"].forEach(function (e) {
                t[e] = function (t) {
                    return this._invoke(e, t)
                }
            })
        }
        function c(t) {
            function e(r, i, o, a) {
                var c = n(t[r], t, i);
                if ("throw" !== c.type) {
                    var u = c.arg,
                        s = u.value;
                    return s && "object" === (void 0 === s ? "undefined" : _typeof(s)) && g.call(s, "__await") ? Promise.resolve(s.__await).then(function (t) {
                        e("next", t, o, a)
                    },
                        function (t) {
                            e("throw", t, o, a)
                        }) : Promise.resolve(s).then(function (t) {
                            u.value = t,
                                o(u)
                        },
                            function (t) {
                                return e("throw", t, o, a)
                            })
                }
                a(c.arg)
            }
            function r(t, n) {
                function r() {
                    return new Promise(function (r, i) {
                        e(t, n, r, i)
                    })
                }
                return i = i ? i.then(r, r) : r()
            }
            var i;
            this._invoke = r
        }
        function u(t, e, r) {
            var i = T;
            return function (o, a) {
                if (i === U) throw new Error("Generator is already running");
                if (i === b) {
                    if ("throw" === o) throw a;
                    return h()
                }
                for (r.method = o, r.arg = a; ;) {
                    var c = r.delegate;
                    if (c) {
                        var u = s(c, r);
                        if (u) {
                            if (u === D) continue;
                            return u
                        }
                    }
                    if ("next" === r.method) r.sent = r._sent = r.arg;
                    else if ("throw" === r.method) {
                        if (i === T) throw i = b,
                            r.arg;
                        r.dispatchException(r.arg)
                    } else "return" === r.method && r.abrupt("return", r.arg);
                    i = U;
                    var l = n(t, e, r);
                    if ("normal" === l.type) {
                        if (i = r.done ? b : L, l.arg === D) continue;
                        return {
                            value: l.arg,
                            done: r.done
                        }
                    }
                    "throw" === l.type && (i = b, r.method = "throw", r.arg = l.arg)
                }
            }
        }
        function s(t, e) {
            var r = t.iterator[e.method];
            if (r === v) {
                if (e.delegate = null, "throw" === e.method) {
                    if (t.iterator.
                        return && (e.method = "return", e.arg = v, s(t, e), "throw" === e.method)) return D;
                    e.method = "throw",
                        e.arg = new TypeError("The iterator does not provide a 'throw' method")
                }
                return D
            }
            var i = n(r, t.iterator, e.arg);
            if ("throw" === i.type) return e.method = "throw",
                e.arg = i.arg,
                e.delegate = null,
                D;
            var o = i.arg;
            return o ? o.done ? (e[t.resultName] = o.value, e.next = t.nextLoc, "return" !== e.method && (e.method = "next", e.arg = v), e.delegate = null, D) : o : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, D)
        }
        function l(t) {
            var e = {
                tryLoc: t[0]
            };
            1 in t && (e.catchLoc = t[1]),
                2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]),
                this.tryEntries.push(e)
        }
        function f(t) {
            var e = t.completion || {};
            e.type = "normal",
                delete e.arg,
                t.completion = e
        }
        function d(t) {
            this.tryEntries = [{
                tryLoc: "root"
            }],
                t.forEach(l, this),
                this.reset(!0)
        }
        function p(t) {
            if (t) {
                var e = t[w];
                if (e) return e.call(t);
                if ("function" == typeof t.next) return t;
                if (!isNaN(t.length)) {
                    var n = -1,
                        r = function e() {
                            for (; ++n < t.length;) if (g.call(t, n)) return e.value = t[n],
                                e.done = !1,
                                e;
                            return e.value = v,
                                e.done = !0,
                                e
                        };
                    return r.next = r
                }
            }
            return {
                next: h
            }
        }
        function h() {
            return {
                value: v,
                done: !0
            }
        }
        var v, m = Object.prototype,
            g = m.hasOwnProperty,
            y = "function" == typeof Symbol ? Symbol : {},
            w = y.iterator || "@@iterator",
            I = y.asyncIterator || "@@asyncIterator",
            S = y.toStringTag || "@@toStringTag";
        t.wrap = e;
        var T = "suspendedStart",
            L = "suspendedYield",
            U = "executing",
            b = "completed",
            D = {},
            x = {};
        x[w] = function () {
            return this
        };
        var E = Object.getPrototypeOf,
            _ = E && E(E(p([])));
        _ && _ !== m && g.call(_, w) && (x = _);
        var N = o.prototype = r.prototype = Object.create(x);
        return i.prototype = N.constructor = o,
            o.constructor = i,
            o[S] = i.displayName = "GeneratorFunction",
            t.isGeneratorFunction = function (t) {
                var e = "function" == typeof t && t.constructor;
                return !!e && (e === i || "GeneratorFunction" === (e.displayName || e.name))
            },
            t.mark = function (t) {
                return Object.setPrototypeOf ? Object.setPrototypeOf(t, o) : (t.__proto__ = o, S in t || (t[S] = "GeneratorFunction")),
                    t.prototype = Object.create(N),
                    t
            },
            t.awrap = function (t) {
                return {
                    __await: t
                }
            },
            a(c.prototype),
            c.prototype[I] = function () {
                return this
            },
            t.AsyncIterator = c,
            t.async = function (n, r, i, o) {
                var a = new c(e(n, r, i, o));
                return t.isGeneratorFunction(r) ? a : a.next().then(function (t) {
                    return t.done ? t.value : a.next()
                })
            },
            a(N),
            N[S] = "Generator",
            N[w] = function () {
                return this
            },
            N.toString = function () {
                return "[object Generator]"
            },
            t.keys = function (t) {
                var e = [];
                for (var n in t) e.push(n);
                return e.reverse(),
                    function n() {
                        for (; e.length;) {
                            var r = e.pop();
                            if (r in t) return n.value = r,
                                n.done = !1,
                                n
                        }
                        return n.done = !0,
                            n
                    }
            },
            t.values = p,
            d.prototype = {
                constructor: d,
                reset: function (t) {
                    if (this.prev = 0, this.next = 0, this.sent = this._sent = v, this.done = !1, this.delegate = null, this.method = "next", this.arg = v, this.tryEntries.forEach(f), !t) for (var e in this) "t" === e.charAt(0) && g.call(this, e) && !isNaN(+ e.slice(1)) && (this[e] = v)
                },
                stop: function () {
                    this.done = !0;
                    var t = this.tryEntries[0],
                        e = t.completion;
                    if ("throw" === e.type) throw e.arg;
                    return this.rval
                },
                dispatchException: function (t) {
                    function e(e, r) {
                        return o.type = "throw",
                            o.arg = t,
                            n.next = e,
                            r && (n.method = "next", n.arg = v),
                            !!r
                    }
                    if (this.done) throw t;
                    for (var n = this,
                        r = this.tryEntries.length - 1; r >= 0; --r) {
                        var i = this.tryEntries[r],
                            o = i.completion;
                        if ("root" === i.tryLoc) return e("end");
                        if (i.tryLoc <= this.prev) {
                            var a = g.call(i, "catchLoc"),
                                c = g.call(i, "finallyLoc");
                            if (a && c) {
                                if (this.prev < i.catchLoc) return e(i.catchLoc, !0);
                                if (this.prev < i.finallyLoc) return e(i.finallyLoc)
                            } else if (a) {
                                if (this.prev < i.catchLoc) return e(i.catchLoc, !0)
                            } else {
                                if (!c) throw new Error("try statement without catch or finally");
                                if (this.prev < i.finallyLoc) return e(i.finallyLoc)
                            }
                        }
                    }
                },
                abrupt: function (t, e) {
                    for (var n = this.tryEntries.length - 1; n >= 0; --n) {
                        var r = this.tryEntries[n];
                        if (r.tryLoc <= this.prev && g.call(r, "finallyLoc") && this.prev < r.finallyLoc) {
                            var i = r;
                            break
                        }
                    }
                    i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
                    var o = i ? i.completion : {};
                    return o.type = t,
                        o.arg = e,
                        i ? (this.method = "next", this.next = i.finallyLoc, D) : this.complete(o)
                },
                complete: function (t, e) {
                    if ("throw" === t.type) throw t.arg;
                    return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e),
                        D
                },
                finish: function (t) {
                    for (var e = this.tryEntries.length - 1; e >= 0; --e) {
                        var n = this.tryEntries[e];
                        if (n.finallyLoc === t) return this.complete(n.completion, n.afterLoc),
                            f(n),
                            D
                    }
                },
                catch: function (t) {
                    for (var e = this.tryEntries.length - 1; e >= 0; --e) {
                        var n = this.tryEntries[e];
                        if (n.tryLoc === t) {
                            var r = n.completion;
                            if ("throw" === r.type) {
                                var i = r.arg;
                                f(n)
                            }
                            return i
                        }
                    }
                    throw new Error("illegal catch attempt")
                },
                delegateYield: function (t, e, n) {
                    return this.delegate = {
                        iterator: p(t),
                        resultName: e,
                        nextLoc: n
                    },
                        "next" === this.method && (this.arg = v),
                        D
                }
            },
            t
    }("object" === ("undefined" == typeof module ? "undefined" : _typeof(module)) ? module.exports : {}),
    RC4 = function () {
        return function t(e, n, r) {
            function i(a, c) {
                if (!n[a]) {
                    if (!e[a]) {
                        var u = "function" == typeof require && require;
                        if (!c && u) return u(a, !0);
                        if (o) return o(a, !0);
                        var s = new Error("Cannot find module '" + a + "'");
                        throw s.code = "MODULE_NOT_FOUND",
                        s
                    }
                    var l = n[a] = {
                        exports: {}
                    };
                    e[a][0].call(l.exports,
                        function (t) {
                            var n = e[a][1][t];
                            return i(n || t)
                        },
                        l, l.exports, t, e, n, r)
                }
                return n[a].exports
            }
            for (var o = "function" == typeof require && require,
                a = 0; a < r.length; a++) i(r[a]);
            return i
        }({
            1: [function (t, e, n) {
                function r() {
                    l = !1,
                        c.length ? s = c.concat(s) : f = -1,
                        s.length && i()
                }
                function i() {
                    if (!l) {
                        var t = setTimeout(r);
                        l = !0;
                        for (var e = s.length; e;) {
                            for (c = s, s = []; ++f < e;) c && c[f].run();
                            f = -1,
                                e = s.length
                        }
                        c = null,
                            l = !1,
                            clearTimeout(t)
                    }
                }
                function o(t, e) {
                    this.fun = t,
                        this.array = e
                }
                function a() { }
                var c, u = e.exports = {},
                    s = [],
                    l = !1,
                    f = -1;
                u.nextTick = function (t) {
                    var e = new Array(arguments.length - 1);
                    if (arguments.length > 1) for (var n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
                    s.push(new o(t, e)),
                        1 !== s.length || l || setTimeout(i, 0)
                },
                    o.prototype.run = function () {
                        this.fun.apply(null, this.array)
                    },
                    u.title = "browser",
                    u.browser = !0,
                    u.env = {},
                    u.argv = [],
                    u.version = "",
                    u.versions = {},
                    u.on = a,
                    u.addListener = a,
                    u.once = a,
                    u.off = a,
                    u.removeListener = a,
                    u.removeAllListeners = a,
                    u.emit = a,
                    u.binding = function (t) {
                        throw new Error("process.binding is not supported")
                    },
                    u.cwd = function () {
                        return "/"
                    },
                    u.chdir = function (t) {
                        throw new Error("process.chdir is not supported")
                    },
                    u.umask = function () {
                        return 0
                    }
            },
            {}],
            2: [function (t, e, n) {
                function r(t) {
                    if (Array.isArray(t)) {
                        for (var e = 0,
                            n = Array(t.length); e < t.length; e++) n[e] = t[e];
                        return n
                    }
                    return Array.from(t)
                }
                function i(t) {
                    u = a(t)
                }
                function o(t) {
                    for (var e = [], n = 0, r = t.length; r > n; n++) e.push(t.charCodeAt(n));
                    return e
                }
                function a(t) {
                    for (var e = [].concat(r(Array(256).keys())), n = 0, t = o(t), i = 0, a = e.length; a > i; i++) {
                        n = (n + e[i] + t[i % t.length]) % 256;
                        var c = [e[n], e[i]];
                        e[i] = c[0],
                            e[n] = c[1]
                    }
                    return e
                }
                function c(t) {
                    var e, n, r = new Array;
                    e = t.length;
                    for (var i = 0; i < e; i++) n = t.charCodeAt(i),
                        n >= 65536 && n <= 1114111 ? (r.push(n >> 18 & 7 | 240), r.push(n >> 12 & 63 | 128), r.push(n >> 6 & 63 | 128), r.push(63 & n | 128)) : n >= 2048 && n <= 65535 ? (r.push(n >> 12 & 15 | 224), r.push(n >> 6 & 63 | 128), r.push(63 & n | 128)) : n >= 128 && n <= 2047 ? (r.push(n >> 6 & 31 | 192), r.push(63 & n | 128)) : r.push(255 & n);
                    return r
                }
                var u = "",
                    s = regeneratorRuntime.mark(function t(e) {
                        var n, r, i;
                        return regeneratorRuntime.wrap(function (t) {
                            for (; ;) switch (t.prev = t.next) {
                                case 0:
                                    n = 0,
                                        r = 0;
                                case 1:
                                    return n = (n + 1) % 256,
                                        r = (r + e[n]) % 256,
                                        i = [e[r], e[n]],
                                        e[n] = i[0],
                                        e[r] = i[1],
                                        t.next = 9,
                                        e[(e[n] + e[r]) % 256];
                                case 9:
                                    t.next = 1;
                                    break;
                                case 11:
                                case "end":
                                    return t.stop()
                            }
                        },
                            t, this)
                    });
                i.prototype.encrypt = function (t) {
                    for (var e = c(t), n = e.length, r = new ArrayBuffer(n), i = s(u.slice(0)), o = new Int8Array(r), a = 0; n > a; a++) o[a] = e[a] ^ i.next().value;
                    return o
                },
                    i.prototype.decrypt = function (t) {
                        var e = "",
                            n = s(u.slice(0));
                        t = t.match(/[a-z0-9]{2}/gi);
                        for (var r = 0,
                            i = t.length; i > r; r++) e += String.fromCharCode(parseInt(t[r], 16) ^ n.next().value);
                        return e
                    },
                    e.exports = i
            },
            {}],
            3: [function (t, e, n) {
                (function (t, n) {
                    function r(t) {
                        return t && "undefined" != typeof Symbol && t.constructor === Symbol ? "symbol" : void 0 === t ? "undefined" : _typeof(t)
                    } !
                        function (n) {
                            function i(t, e, n, r) {
                                var i = Object.create((e || a).prototype),
                                    o = new v(r || []);
                                return i._invoke = d(t, n, o),
                                    i
                            }
                            function o(t, e, n) {
                                try {
                                    return {
                                        type: "normal",
                                        arg: t.call(e, n)
                                    }
                                } catch (t) {
                                    return {
                                        type: "throw",
                                        arg: t
                                    }
                                }
                            }
                            function a() { }
                            function c() { }
                            function u() { }
                            function s(t) {
                                ["next", "throw", "return"].forEach(function (e) {
                                    t[e] = function (t) {
                                        return this._invoke(e, t)
                                    }
                                })
                            }
                            function l(t) {
                                this.arg = t
                            }
                            function f(e) {
                                function n(t, n) {
                                    var r = e[t](n),
                                        i = r.value;
                                    return i instanceof l ? Promise.resolve(i.arg).then(a, c) : Promise.resolve(i).then(function (t) {
                                        return r.value = t,
                                            r
                                    })
                                }
                                function i(t, e) {
                                    function r() {
                                        return n(t, e)
                                    }
                                    return o = o ? o.then(r, r) : new Promise(function (t) {
                                        t(r())
                                    })
                                }
                                "object" === (void 0 === t ? "undefined" : r(t)) && t.domain && (n = t.domain.bind(n));
                                var o, a = n.bind(e, "next"),
                                    c = n.bind(e, "throw");
                                n.bind(e, "return"),
                                    this._invoke = i
                            }
                            function d(t, e, n) {
                                var r = L;
                                return function (i, a) {
                                    if (r === b) throw new Error("Generator is already running");
                                    if (r === D) {
                                        if ("throw" === i) throw a;
                                        return g()
                                    }
                                    for (; ;) {
                                        var c = n.delegate;
                                        if (c) {
                                            if ("return" === i || "throw" === i && c.iterator[i] === y) {
                                                n.delegate = null;
                                                var u = c.iterator.
                                                    return;
                                                if (u) {
                                                    var s = o(u, c.iterator, a);
                                                    if ("throw" === s.type) {
                                                        i = "throw",
                                                            a = s.arg;
                                                        continue
                                                    }
                                                }
                                                if ("return" === i) continue
                                            }
                                            var s = o(c.iterator[i], c.iterator, a);
                                            if ("throw" === s.type) {
                                                n.delegate = null,
                                                    i = "throw",
                                                    a = s.arg;
                                                continue
                                            }
                                            i = "next",
                                                a = y;
                                            var l = s.arg;
                                            if (!l.done) return r = U,
                                                l;
                                            n[c.resultName] = l.value,
                                                n.next = c.nextLoc,
                                                n.delegate = null
                                        }
                                        if ("next" === i) n._sent = a,
                                            n.sent = r === U ? a : y;
                                        else if ("throw" === i) {
                                            if (r === L) throw r = D,
                                                a;
                                            n.dispatchException(a) && (i = "next", a = y)
                                        } else "return" === i && n.abrupt("return", a);
                                        r = b;
                                        var s = o(t, e, n);
                                        if ("normal" === s.type) {
                                            r = n.done ? D : U;
                                            var l = {
                                                value: s.arg,
                                                done: n.done
                                            };
                                            if (s.arg !== x) return l;
                                            n.delegate && "next" === i && (a = y)
                                        } else "throw" === s.type && (r = D, i = "throw", a = s.arg)
                                    }
                                }
                            }
                            function p(t) {
                                var e = {
                                    tryLoc: t[0]
                                };
                                1 in t && (e.catchLoc = t[1]),
                                    2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]),
                                    this.tryEntries.push(e)
                            }
                            function h(t) {
                                var e = t.completion || {};
                                e.type = "normal",
                                    delete e.arg,
                                    t.completion = e
                            }
                            function v(t) {
                                this.tryEntries = [{
                                    tryLoc: "root"
                                }],
                                    t.forEach(p, this),
                                    this.reset(!0)
                            }
                            function m(t) {
                                if (t) {
                                    var e = t[I];
                                    if (e) return e.call(t);
                                    if ("function" == typeof t.next) return t;
                                    if (!isNaN(t.length)) {
                                        var n = -1,
                                            r = function e() {
                                                for (; ++n < t.length;) if (w.call(t, n)) return e.value = t[n],
                                                    e.done = !1,
                                                    e;
                                                return e.value = y,
                                                    e.done = !0,
                                                    e
                                            };
                                        return r.next = r
                                    }
                                }
                                return {
                                    next: g
                                }
                            }
                            function g() {
                                return {
                                    value: y,
                                    done: !0
                                }
                            }
                            var y, w = Object.prototype.hasOwnProperty,
                                I = "function" == typeof Symbol && Symbol.iterator || "@@iterator",
                                S = "object" === (void 0 === e ? "undefined" : r(e)),
                                T = n.regeneratorRuntime;
                            if (T) return void (S && (e.exports = T));
                            T = n.regeneratorRuntime = S ? e.exports : {},
                                T.wrap = i;
                            var L = "suspendedStart",
                                U = "suspendedYield",
                                b = "executing",
                                D = "completed",
                                x = {},
                                E = u.prototype = a.prototype;
                            c.prototype = E.constructor = u,
                                u.constructor = c,
                                c.displayName = "GeneratorFunction",
                                T.isGeneratorFunction = function (t) {
                                    var e = "function" == typeof t && t.constructor;
                                    return !!e && (e === c || "GeneratorFunction" === (e.displayName || e.name))
                                },
                                T.mark = function (t) {
                                    return Object.setPrototypeOf ? Object.setPrototypeOf(t, u) : t.__proto__ = u,
                                        t.prototype = Object.create(E),
                                        t
                                },
                                T.awrap = function (t) {
                                    return new l(t)
                                },
                                s(f.prototype),
                                T.async = function (t, e, n, r) {
                                    var o = new f(i(t, e, n, r));
                                    return T.isGeneratorFunction(e) ? o : o.next().then(function (t) {
                                        return t.done ? t.value : o.next()
                                    })
                                },
                                s(E),
                                E[I] = function () {
                                    return this
                                },
                                E.toString = function () {
                                    return "[object Generator]"
                                },
                                T.keys = function (t) {
                                    var e = [];
                                    for (var n in t) e.push(n);
                                    return e.reverse(),
                                        function n() {
                                            for (; e.length;) {
                                                var r = e.pop();
                                                if (r in t) return n.value = r,
                                                    n.done = !1,
                                                    n
                                            }
                                            return n.done = !0,
                                                n
                                        }
                                },
                                T.values = m,
                                v.prototype = {
                                    constructor: v,
                                    reset: function (t) {
                                        if (this.prev = 0, this.next = 0, this.sent = y, this.done = !1, this.delegate = null, this.tryEntries.forEach(h), !t) for (var e in this) "t" === e.charAt(0) && w.call(this, e) && !isNaN(+ e.slice(1)) && (this[e] = y)
                                    },
                                    stop: function () {
                                        this.done = !0;
                                        var t = this.tryEntries[0],
                                            e = t.completion;
                                        if ("throw" === e.type) throw e.arg;
                                        return this.rval
                                    },
                                    dispatchException: function (t) {
                                        function e(e, r) {
                                            return o.type = "throw",
                                                o.arg = t,
                                                n.next = e,
                                                !!r
                                        }
                                        if (this.done) throw t;
                                        for (var n = this,
                                            r = this.tryEntries.length - 1; r >= 0; --r) {
                                            var i = this.tryEntries[r],
                                                o = i.completion;
                                            if ("root" === i.tryLoc) return e("end");
                                            if (i.tryLoc <= this.prev) {
                                                var a = w.call(i, "catchLoc"),
                                                    c = w.call(i, "finallyLoc");
                                                if (a && c) {
                                                    if (this.prev < i.catchLoc) return e(i.catchLoc, !0);
                                                    if (this.prev < i.finallyLoc) return e(i.finallyLoc)
                                                } else if (a) {
                                                    if (this.prev < i.catchLoc) return e(i.catchLoc, !0)
                                                } else {
                                                    if (!c) throw new Error("try statement without catch or finally");
                                                    if (this.prev < i.finallyLoc) return e(i.finallyLoc)
                                                }
                                            }
                                        }
                                    },
                                    abrupt: function (t, e) {
                                        for (var n = this.tryEntries.length - 1; n >= 0; --n) {
                                            var r = this.tryEntries[n];
                                            if (r.tryLoc <= this.prev && w.call(r, "finallyLoc") && this.prev < r.finallyLoc) {
                                                var i = r;
                                                break
                                            }
                                        }
                                        i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
                                        var o = i ? i.completion : {};
                                        return o.type = t,
                                            o.arg = e,
                                            i ? this.next = i.finallyLoc : this.complete(o),
                                            x
                                    },
                                    complete: function (t, e) {
                                        if ("throw" === t.type) throw t.arg;
                                        "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = t.arg, this.next = "end") : "normal" === t.type && e && (this.next = e)
                                    },
                                    finish: function (t) {
                                        for (var e = this.tryEntries.length - 1; e >= 0; --e) {
                                            var n = this.tryEntries[e];
                                            if (n.finallyLoc === t) return this.complete(n.completion, n.afterLoc),
                                                h(n),
                                                x
                                        }
                                    },
                                    catch: function (t) {
                                        for (var e = this.tryEntries.length - 1; e >= 0; --e) {
                                            var n = this.tryEntries[e];
                                            if (n.tryLoc === t) {
                                                var r = n.completion;
                                                if ("throw" === r.type) {
                                                    var i = r.arg;
                                                    h(n)
                                                }
                                                return i
                                            }
                                        }
                                        throw new Error("illegal catch attempt")
                                    },
                                    delegateYield: function (t, e, n) {
                                        return this.delegate = {
                                            iterator: m(t),
                                            resultName: e,
                                            nextLoc: n
                                        },
                                            x
                                    }
                                }
                        }("object" === (void 0 === n ? "undefined" : r(n)) ? n : "object" === ("undefined" == typeof window ? "undefined" : r(window)) ? window : "object" === ("undefined" == typeof self ? "undefined" : r(self)) ? self : void 0)
                }).call(this, t("_process"), "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
            },
            {
                _process: 1
            }],
            4: [function (t, e, n) {
                e.exports = {
                    full: "1.2.0",
                    major: "1",
                    minor: "2",
                    dot: "0"
                }
            },
            {}]
        },
            {},
            [2])(2)
    }(),
    isDebug = "debugVal",
    Util = {
        firstInit: !1,
        initTime: 0,
        sessionId: "",
        sessionStartTime: 0,
        appLaunchInfo: null,
        sendFailTimes: 0,
        bakData: {},
        Store: {
            set: function (t, e) {
                try {
                    pfEnv && pfEnv.setStorageSync("TDSDK_" + t, e)
                } catch (t) { }
                Util.bakData["TDSDK_" + t] = e
            },
            get: function (t) {
                var e = null;
                try {
                    e = pfEnv && pfEnv.getStorageSync("TDSDK_" + t) || ''
                } catch (t) { }
                return e || (e = Util.bakData["TDSDK_" + t] || null),
                    e
            },
            remove: function (t) {
                try {
                    pfEnv && pfEnv.removeStorageSync("TDSDK_" + t)
                } catch (t) { }
                delete Util.bakData["TDSDK_" + t]
            },
            getInfo: function () {
                try {
                    return pfEnv && pfEnv.getStorageInfoSync() || {}
                } catch (t) {
                    return {}
                }
            }
        },
        random: function () {
            for (var t = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
                e = t.length,
                n = "",
                r = 0; r < 12; r++) n += t.charAt(Math.floor(Math.random() * e));
            return n
        },
        isNumber: function (t) {
            return "number" == typeof t && !isNaN(t)
        },
        timestamp: function () {
            return (new Date).getTime()
        },
        deviceId: function () {
            return "weapp-" + this.timestamp() + "-" + this.random()
        },
        getEventId: function (t) {
            if (!t && !/0{1}/.test(t)) return "";
            var e = "";
            try {
                e = t.toString()
            } catch (n) {
                try {
                    e = JSON.stringify(t)
                } catch (t) { }
            }
            return e.split(" ")[0].slice(0, 64)
        },
        addStoreData: function () {
            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [],
                e = "EVENT_" + Util.sessionId,
                n = Util.Store.get(e);
            n = n && n.length ? n.concat(t) : t,
                Util.Store.set(e, n),
                n.length >= 30 && (onLaunchFn.sessionContinue(), onLaunchFn.startLoop())
        },
        eventHandle: function () {
            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "",
                e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
            if (t) {
                var n = {
                    eventId: t,
                    count: 1,
                    startTime: Util.timestamp()
                };
                if ("WeappShare" === t) {
                    n.shareTickets = e.shareTickets;
                    var r = {};
                    r.user = Util.deviceId,
                        r.title = e.title,
                        r.desc = e.desc;
                    var i = e.path;
                    i ? (i = Util.getUrl("", Util.getSearchParams(e.path)), i = i.substring(1)) : console.log("分享事件的path参数缺少有效值"),
                        r.path = i,
                        n.params = r
                }
                Util.addStoreData([n])
            }
        },
        getCacheData: function () {
            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
                e = Object.keys(t),
                n = [],
                r = [];
            return e.length && e.forEach(function (e) {
                var i = t[e];
                i && i.sendFail && i.data && (n = n.concat(i.data), r.push(e))
            }),
            {
                data: n,
                keys: r
            }
        },
        sendCacheList: {},
        updateSendTime: function () {
            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [],
                e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
                n = appInfo.device.deviceId,
                r = Util.Store.get("uid"),
                i = Util.Store.get("deviceId");
            return t.forEach(function (o, a) {
                if (!o.device.deviceId.tid && !o.device.deviceId.uid) if (n.tid) {
                    if (o.device.deviceId.tid = n.tid, n.uid) return o.device.deviceId.uid = n.uid,
                        !0
                } else {
                    if (n.uid) return o.device.deviceId.uid = n.uid,
                        o.device.deviceId.tid = n.uid,
                        !0;
                    if (TDID.isWaitingForOpenid) {
                        if (r) return o.device.deviceId.uid = r,
                            o.device.deviceId.tid = r,
                            n.uid = r,
                            n.tid = r,
                            !0;
                        if (i) o.device.deviceId.tid = i,
                            o.device.deviceId.uid = "";
                        else {
                            var c = Util.deviceId();
                            n.tid = c,
                                n.uid = "",
                                Util.Store.set("deviceId", c),
                                o.device.deviceId.tid = c,
                                o.device.deviceId.uid = "",
                                TDID.shouldOverwriteTid = !1
                        }
                    } else o.device.deviceId.tid = n.tid,
                        o.device.deviceId.uid = n.uid
                }
                o.action && o.action.data && (t[a].action.data.start = e)
            }),
                t
        },
        getRequestData: function () {
            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [],
                e = JSON.parse(JSON.stringify(t)),
                n = Util.sendCacheList;
            if (Object.keys(n).length) {
                var r = Util.getCacheData(n);
                e = e.concat(r.data),
                    r.keys.forEach(function (t) {
                        return delete n[t]
                    })
            }
            var i = e.length;
            if (i) {
                var o = [];
                if (i >= 30) {
                    JSON.stringify(e).length > 61440 && o.push(e.splice(0, i / 2)),
                        o.push(e)
                } else o.push(e);
                o.forEach(function (t) {
                    var e = Util.timestamp();
                    n[e] = {
                        data: t,
                        sendFail: !1
                    };
                    var r = Util.updateSendTime(t, Util.timestamp());
                    Util.request(e, r)
                })
            }
        },
        handleData: function (t) {
            return new RC4("r5czusfu0wjcaz4pp01v2k7qte55xc25fngq4ylby2civ230vdy6uy6goz9w4kgfqjk31l8khfzfvbxj7emcprjyy8nngf0r9dvxzwbhm2uw7ljre52jt95lg0knyp8e5c4go44s3z5ciy58h0tuosmwhupa62rdnkeicgdba6w6f0kenp0xac7so8j1vdbjpqwyprx2ouenv22isustwnpltt9ui5plnijd4bq4013o3mzdkllozn26zwds9x38").encrypt(t)
        },
        request: function () {
            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0,
                e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [],
                n = Util.handleData(JSON.stringify(e));
            "9853" === isDebug && console.log(e),
                pfEnv && pfEnv.request({
                    url: _requestUrl,
                    data: n.buffer,
                    header: {
                        "content-type": "application/octet-stream",
                        "decrypt-version": "v1.0.0"
                    },
                    method: "POST",
                    success: function (e) {
                        200 === e.statusCode && (delete Util.sendCacheList[t], Util.sendFailTimes = 0, appHandle.appIsHide || (clearTimeout(onLaunchFn.timeout), onLaunchFn.timeout = null, onLaunchFn.startLoop()))
                    },
                    fail: function () {
                        appHandle.appIsHide ? (Util.Store.set("RESEND_" + t, e), delete Util.sendCacheList[t]) : (Util.sendCacheList[t].sendFail = !0, Util.sendFailTimes < 5 && Util.sendFailTimes++)
                    }
                })
        },
        getUrl: function () {
            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "",
                e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
                n = Object.keys(e),
                r = n.sort() || [],
                i = r.length ? t + "?" : t;
            return r.forEach(function (t, n) {
                0 !== n && (i += "&"),
                    i += t + "=" + e[t]
            }),
                i
        },
        getSearchParams: function (t) {
            if (!t) return {};
            var e = {};
            return t.split("&").forEach(function (t) {
                var n = t.split("=");
                2 === n.length && (e[n[0]] = n[1])
            }),
                e
        }
    },
    TDID = {
        shouldOverwriteTid: !0,
        isWaitingForOpenid: !0,
        isFirst: !0,
        init: function () {
            var t = this,
                e = Util.Store.get("deviceId"),
                n = Util.Store.get("uid");
            if (n) {
                var r = e || n;
                t.setData(r, n)
            } else {
                new Promise(this.getOpenid).then(function (n) {
                    var r = void 0;
                    e ? r = e : (r = n, Util.Store.set("deviceId", n)),
                        t.setData(r, n),
                        Util.Store.set("uid", n),
                        TDID.isWaitingForOpenid = !1
                }).
                    catch(function (n) {
                        var r = void 0;
                        r = e || Util.deviceId(),
                            t.setData(r, ""),
                            TDID.shouldOverwriteTid && Util.Store.set("deviceId", r),
                            TDID.isWaitingForOpenid = !1
                    })
            }
        },
        setData: function (t, e) {
            TDID.shouldOverwriteTid ? appInfo.device.deviceId = {
                tid: t,
                uid: e
            } : appInfo.device.deviceId.uid = e,
                waitFlag.uid = !1,
                onLaunchFn.getAppProfile()
        },
        getOpenid: function (t, e) {
            if (_openId) {
                t(_openId);
                return;
            }
            _openIdCallback.push(t);
        },
        reGetOpenid: function (t, e) {
            TDID.isFirst = !1,
                TDID.getOpenid(t, e)
        }
    },
    DomainName = {
        placeOrder: {
            domain: "iap",
            name: "placeOrder"
        },
        orderPaySucc: {
            domain: "iap",
            name: "pay"
        },
        cancelOrder: {
            domain: "iap",
            name: "cancelOrder"
        },
        register: {
            domain: "account",
            name: "register"
        },
        login: {
            domain: "account",
            name: "login"
        },
        update: {
            domain: "account",
            name: "update"
        }
    },
    request = {
        sendTime: 0,
        statusType: function () {
            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
                e = [],
                n = JSON.parse(JSON.stringify(appInfo)),
                r = {
                    domain: t.domain,
                    name: t.name,
                    data: t.data
                };
            n.ts = t.data.start || Util.timestamp(),
                n.action = r,
                e.push(n),
                Util.getRequestData(e)
        },
        dataType: function (t, e) {
            var n = this.getStoreList(t, e);
            Util.getRequestData(n)
        },
        getEventType: function () {
            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
                e = DomainName[t.domainName];
            if (e) return e;
            if (t.pageEvent) return {
                domain: "page",
                name: "leave"
            };
            if (t.eventId) {
                var n = t.eventId,
                    r = {};
                switch (n) {
                    case "WeappShare":
                        r = {
                            domain: "user",
                            name: "share"
                        };
                        break;
                    case "WeappPullDownRefresh":
                        r = {
                            domain: "page",
                            name: "pullDownRefresh"
                        };
                        break;
                    case "WeappReachBottom":
                        r = {
                            domain: "page",
                            name: "reachBottom"
                        };
                        break;
                    default:
                        r = {
                            domain: "appEvent",
                            name: ""
                        }
                }
                return r
            }
        },
        getStoreList: function (t, e) {
            var n = this,
                r = [],
                i = t || Util.sessionId,
                o = JSON.stringify(appInfo),
                a = Util.Store.get("EVENT_" + i);
            return a && a.length && (a.forEach(function (t) {
                var i = n.getEventType(t),
                    a = JSON.parse(o);
                e && a.appContext && (a.appContext.sessionStartTime = e);
                var c = JSON.parse(JSON.stringify(t));
                c.pageEvent && delete c.pageEvent,
                    c.domainName || (c.status = 2),
                    c.domainName && delete c.domainName;
                var u = {
                    domain: i.domain,
                    name: i.name,
                    data: c
                };
                a.ts = c.startTime ? c.startTime : Util.timestamp(),
                    a.action = u,
                    r.push(a)
            }), Util.Store.remove("EVENT_" + i)),
                r
        }
    },
    createProfile = function (t) {
        var e = {},
            n = Util.Store.get("account") || {};
        return "update" !== t && "setProfile" !== t || (e = n || {}),
        {
            getInfo: function () {
                return e
            },
            setId: function (t) {
                if ("string" != typeof t || "" === t) return "accountId 类型错误";
                t === n.accountId ? e = n : e.accountId = t
            },
            setName: function (t) {
                if ("string" != typeof t) return "profile name 类型错误";
                e.name = t
            },
            setAge: function (t) {
                if (!Util.isNumber(t)) return "profile age 类型错误";
                e.age = t
            },
            setGender: function (t) {
                var n = Number(t);
                if (0 !== n && 1 !== n && 2 !== n) return "profile gender 类型错误";
                e.gender = n
            },
            setType: function (t) {
                var n = Number(t);
                if (!(Util.isNumber(n) && /^[0-9][0-9]*$/.test(n) && (n >= 0 && n <= 6 || n >= 11 && n <= 20))) return "account type 类型错误";
                e.type = n
            },
            setProperty: function (t, n) {
                if (!Util.isNumber(n) && "string" != typeof n) return "profile " + t + " 类型错误";
                e[t] = n
            }
        }
    },
    Account = {
        handleData: function () {
            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
                e = arguments[1],
                n = createProfile(e),
                r = {
                    name: "setName",
                    gender: "setGender",
                    age: "setAge",
                    accountType: "setType"
                },
                i = !1,
                o = new RegExp("^property[1-9]$");
            if (t.accountId && "update" !== e && "setProfile" !== e) {
                var a = n.setId(t.accountId);
                if (a) return i = !0,
                    console.error(a)
            }
            if (Object.keys(t).forEach(function (e) {
                if (!i) {
                    var a = t[e],
                        c = r[e];
                    if (c) {
                        var u = n[c](a);
                        if (u) return i = !0,
                            console.error(u)
                    } else if (o.test(e) || "property10" === e) {
                        var s = n.setProperty(e, a);
                        if (s) return i = !0,
                            console.error(s)
                    }
                }
            }), !i) {
                var c = n.getInfo();
                if (Account.updateAccountInfo("account", c), "register" === e || "login" === e || "update" === e) {
                    var u = Object.assign({
                        domainName: e
                    },
                        t);
                    Util.addStoreData([u])
                }
            }
        },
        updateAccountInfo: function (t, e) {
            Util.Store.set(t, e),
                Account.assignAccount(e)
        },
        setAccountInfo: function (t) {
            var e = Util.Store.get(t);
            "[object Object]" === Object.prototype.toString.call(e) && Account.assignAccount(e)
        },
        assignAccount: function (t) {
            appInfo.appContext.account = t
        }
    },
    accountApi = {
        register: function () {
            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
            return t.accountId ? t.accountType || 0 === t.accountType ? void Account.handleData(t, "register") : console.error("Register事件缺少accountType字段") : console.error("Register事件缺少accountId字段")
        },
        login: function () {
            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
            return t.accountId ? t.accountType || 0 === t.accountType ? void Account.handleData(t, "login") : console.error("Login事件缺少accountType字段") : console.error("Login事件缺少accountId字段")
        },
        update: function () {
            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
            Account.handleData(t, "update")
        }
    },
    iapEvent = {
        placeOrder: function (t) {
            if (!iapJudge(t)) return !1;
            var e = {
                orderId: t.orderId,
                amount: t.amount,
                currencyType: t.currencyType,
                domainName: "placeOrder"
            };
            Util.addStoreData([e])
        },
        orderPaySucc: function (t) {
            if (!iapJudge(t, !0)) return !1;
            var e = {
                orderId: t.orderId,
                amount: t.amount,
                currencyType: t.currencyType,
                payType: t.paymentType,
                domainName: "orderPaySucc"
            };
            Util.addStoreData([e])
        },
        cancelOrder: function (t) {
            if (!iapJudge(t)) return !1;
            var e = {
                orderId: t.orderId,
                amount: t.amount,
                currencyType: t.currencyType,
                domainName: "cancelOrder"
            };
            Util.addStoreData([e])
        }
    },
    hasDataFlag = !1,
    onLaunchFn = {
        timeout: null,
        init: function (config) {
            appInfo.app.versionCode = config.versionCode || '1';
            appInfo.app.versionName = config.versionName;
            appInfo.app.displayName = config.displayName || '';
            appInfo.app.appKey = config.appKey || '';
            appInfo.app.channel = config.channel || '';

            var t = pfEnv && pfEnv.getLaunchOptionsSync();
            Util.appLaunchInfo = JSON.parse(JSON.stringify(t)),
                Util.appLaunchInfo.scene = t.scene ? t.scene.toString() : "",
                TDID.init(),
                onLaunchFn.judgeRequireData(),
                onLaunchFn.getLocalParams(),
                // customConf.config.getLocation && onLaunchFn.getLocation(),
                onLaunchFn.getSystemInfo(),
                onLaunchFn.getNetwork()
        },
        launchRequest: function () {
            var t = {
                first: !0
            };
            request.statusType({
                domain: "app",
                name: "init",
                data: t
            })
        },
        sessionStart: function (t) {
            var e = Util.appLaunchInfo || {},
                n = {
                    status: 1,
                    duration: 0,
                    name: e.path,
                    scene: e.scene,
                    query: e.query || {},
                    shareTicket: e.shareTicket,
                    referrerInfo: e.referrerInfo
                };
            t && onLaunchFn.setNewSession(),
                n.start = Util.Store.get("session_time") || Util.timestamp(),
                n.url = Util.getUrl(n.name, n.query),
                request.statusType({
                    domain: "session",
                    name: "begin",
                    data: n
                })
        },
        sessionContinue: function () {
            request.dataType()
        },
        sessionEnd: function () {
            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
                e = {
                    status: 3,
                    start: t.startTime,
                    duration: t.duration
                };
            request.statusType({
                domain: "session",
                name: "end",
                data: e
            })
        },
        sendTmpSession: function () {
            onLaunchFn.sessionContinue(),
                onLaunchFn.startLoop()
        },
        startLoop: function () {
            onLaunchFn.timeout && (clearTimeout(onLaunchFn.timeout), onLaunchFn.timeout = null);
            var t = 3e3 * (Util.sendFailTimes + 1);
            onLaunchFn.timeout = setTimeout(function () {
                onLaunchFn.sendTmpSession()
            },
                t)
        },
        judgeRequireData: function () {
            appInfo.app.appKey || (appInfo.app.appKey = "", console.error("请填写您在TalkingData申请的App ID")),
                appInfo.app.displayName || (appInfo.app.displayName = "appname", console.error("请填写您的小程序名称"))
        },
        getLocalParams: function () {
            var t = Util.Store.get("initTime");
            t ? Util.initTime = t : (Util.initTime = Util.timestamp(), Util.Store.set("initTime", Util.initTime), Util.firstInit = !0),
                appInfo.app.installTime = Util.initTime;
            Account && Account.setAccountInfo("account"),
                onLaunchFn.setNewSession()
        },
        setNewSession: function () {
            Util.sessionId = Util.deviceId(),
                Util.sessionStartTime = Util.timestamp(),
                Util.Store.set("session_time", Util.sessionStartTime),
                appInfo.appContext.sessionId = Util.sessionId,
                appInfo.appContext.sessionStartTime = Util.sessionStartTime
        },
        getLaunchInfo: function () {
            var t = JSON.parse(JSON.stringify(onLaunchFn.launchOptions));
            return t.type = "appLaunch",
                t
        },
        getAppProfile: function () {
            if (!hasDataFlag) {
                var t = ["device", "network", "uid"],
                    e = !0;
                t.forEach(function (t) {
                    waitFlag[t] && (e = !1)
                }),
                    e && (hasDataFlag = !0, this.startRequest())
            }
        },
        startRequest: function () {
            Util.firstInit && onLaunchFn.launchRequest(),
                this.sessionStart(),
                this.startLoop()
        },
        getLocation: function () {
        },
        getNetwork: function () {
            pfEnv && pfEnv.getNetworkType({
                success: function (t) {
                    var e = appInfo.networks,
                        n = t.networkType;
                    "wifi" === n ? (e[0].available = !0, e[0].connected = !0) : "unknown" === n ? (e[2].available = !0, e[2].connected = !0) : "none" !== n && (e[1].available = !0, e[1].connected = !0, e[1].current.push({
                        type: n
                    })),
                        waitFlag.network = !1,
                        onLaunchFn.getAppProfile()
                }
            })
        },
        getSystemInfo: function () {
            pfEnv && pfEnv.getSystemInfo({
                success: function (t) {
                    if (t.model || t.system || t.SDKVersion) {
                        var e = {
                            model: t.model,
                            pixel: t.screenWidth + "*" + t.screenHeight + "*" + t.pixelRatio,
                            densityDpi: t.pixelRatio,
                            brand: t.brand
                        },
                            n = {
                                os: t.system,
                                local: t.language,
                                language: "zh_CN",
                                osVersionCode: t.version,
                                timezone: -(new Date).getTimezoneOffset() / 60,
                                mpVersion: t.SDKVersion
                            };
                        appInfo.device.hardwareConfig = e,
                            appInfo.device.softwareConfig = n
                    }
                    waitFlag.device = !1,
                        onLaunchFn.getAppProfile()
                }
            })
        }
    },
    eventHandle = {
        init: onLaunchFn.init,
        setOpenId: function (openId) {
            _openId = openId;
            _openIdCallback.forEach(item => item(_openId));
            _openIdCallback.length = 0;
        },
        event: function () {
            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
                e = Util.getEventId(t.id);
            if (e) {
                var n = {};
                n.eventId = e,
                    n.label = Util.getEventId(t.label),
                    n.count = t.count || 1,
                    n.params = t.params,
                    n.startTime = Util.timestamp(),
                    void 0 !== t.value ? "number" != typeof t.value ? console.error('自定义事件"' + e + '"中value对应的值的类型需为Number类型') : isNaN(t.value) ? console.error('自定义事件"' + e + '"中请输入有效的Number类型数值') : (n.value = t.value, Util.addStoreData([n])) : Util.addStoreData([n])
            }
        },
        share: function () {
            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
            Util.eventHandle("WeappShare", t)
        },
        pullDownRefresh: function () {
            Util.eventHandle("WeappPullDownRefresh")
        },
        reachBottom: function () {
            Util.eventHandle("WeappReachBottom")
        },
        setProfile: function () {
            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
            Account.handleData(t, "setProfile")
        },
        profile: accountApi,
        iap: iapEvent
    },
    appHandle = {
        isHide2Show: !1,
        appIsHide: !1,
        show: function () {
            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
            if (appHandle.appIsHide = !1, appHandle.getlastTmpData(), appHandle.isHide2Show) {
                var e = Util.Store.get("TMP_time_end_" + Util.sessionId),
                    n = t.scene ? t.scene.toString() : "";
                if (t.scene && Util.appLaunchInfo && n === Util.appLaunchInfo.scene) {
                    Util.timestamp() - e > 3e4 ? appHandle.sessionRestart(e) : Util.Store.remove("TMP_time_end_" + Util.sessionId)
                } else Util.appLaunchInfo = JSON.parse(JSON.stringify(t)),
                    Util.appLaunchInfo.scene = n,
                    appHandle.sessionRestart(e);
                appHandle.isHide2Show = !1,
                    onLaunchFn.startLoop()
            }
        },
        sessionRestart: function (t) {
            var e = Util.Store.get("TMP_time_start_" + Util.sessionId),
                n = {
                    startTime: e,
                    duration: parseInt((t - e) / 1e3)
                };
            onLaunchFn.sessionEnd(n),
                Util.Store.remove("TMP_time_start_" + Util.sessionId),
                Util.Store.remove("TMP_time_end_" + Util.sessionId),
                Util.Store.remove("session_time"),
                onLaunchFn.sessionStart(!0)
        },
        hide: function () {
            appHandle.appIsHide = !0,
                clearTimeout(onLaunchFn.timeout),
                onLaunchFn.timeout = null,
                onLaunchFn.sessionContinue(),
                appHandle.isHide2Show = !0,
                Util.Store.set("TMP_time_start_" + Util.sessionId, Util.Store.get("session_time")),
                Util.Store.set("TMP_time_end_" + Util.sessionId, Util.timestamp())
        },
        getlastTmpData: function () {
            var t = [],
                e = Util.Store.getInfo().keys || [],
                n = void 0,
                r = void 0;
            e && e.length && (n = e.filter(function (t) {
                return t.indexOf("TDSDK_EVENT") > -1
            }), r = e.filter(function (t) {
                return t.indexOf("TDSDK_RESEND") > -1
            })),
                n && n.length && (n.forEach(function (e) {
                    var n = {};
                    e.split("_")[2];
                    n.id = e.split("_")[2],
                        n.time = n.id.split("-")[1],
                        t.push(n)
                }), appHandle.sendLastTmpData(t)),
                r && r.length && r.forEach(function (t) {
                    pfEnv && pfEnv.getStorage({
                        key: t,
                        success: function (e) {
                            Util.getRequestData(e.data),
                                pfEnv && pfEnv.removeStorageSync(t);
                        }
                    })
                })
        },
        sendLastTmpData: function () {
            (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []).forEach(function (t) {
                request.dataType(t.id, t.time)
            })
        }
    };
window.tdAppSdk = eventHandle;
pfEnv && pfEnv.onShow(appHandle.show);
pfEnv && pfEnv.onHide(appHandle.hide);